/*
 * Vector3.cpp
 *
 *  Created on: Jan 24, 2010
 *      Author: teddy
 */

#include "Vector3.h"
#include <math.h>
#include <cstddef>

Vector3::Vector3() {
	X = 0.0f;
	Y = 0.0f;
	Z = 0.0f;
}

Vector3::Vector3(float X,float Y,float Z) {
	this->X = X;
	this->Y = Y;
	this->Z = Z;
}

Vector3::~Vector3() {
}

Vector3 Vector3::getInverse()
{
	return Vector3(-X, -Y, -Z);
}

float Vector3::getLength()
{
	return (float) sqrt((X * X) + (Y * Y) + (Z * Z));
}

Vector3 Vector3::getNormal()
{
	Vector3 normal;
	float l = this->getLength();

	if(l == 0.0f)
	return normal;

	normal = Vector3(X / l, Y / l, Z / l);
	return normal;
}


